//
//  FLLLoginAndRegisterTextField.m
//  FLLGodOfCookery
//
//  Created by LL.F on 16/8/30.
//  Copyright © 2016年 LL.F. All rights reserved.
//

#import "FLLLoginAndRegisterTextField.h"
#import "FLLMacro.h"

// 占位文字颜色
#define FLLPlaceholderColorKey @"placeholderLabel.textColor"
// 输入框光标颜色
#define FLLPlaceholderFocusColor [UIColor colorWithRed:1.00 green:0.45 blue:0.32 alpha:1.00]
// 输入文字的颜色
#define FLLTextFocusColor [UIColor whiteColor]
// 聚焦时占位文字的颜色
#define FLLPlaceholderFocusColor [UIColor whiteColor]
@interface FLLLoginAndRegisterTextField ()<UITextFieldDelegate>

@end

@implementation FLLLoginAndRegisterTextField

- (void)awakeFromNib
{
    
    // 文本框的光标颜色
    self.tintColor = FLLPlaceholderFocusColor;
    // 文字颜色
    self.textColor = FLLTextFocusColor;
    // 设置占位文字的颜色
    [self setValue:[UIColor grayColor]
        forKeyPath:FLLPlaceholderColorKey];
    [self resignFirstResponder];
    
}
// 成为第一响应者
- (BOOL)becomeFirstResponder
{

    [self setValue:FLLPlaceholderFocusColor forKeyPath:FLLPlaceholderColorKey];
    return [super becomeFirstResponder];
}
// 失去第一响应者
- (BOOL)resignFirstResponder
{
    [self setValue:[UIColor grayColor]
        forKeyPath:FLLPlaceholderColorKey];
    return [super resignFirstResponder];
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
